var app = getApp();
var util = require("../../utils/util.js");
var siteinfo = require('../../siteinfo.js');
Page({
    data: {
       idNumber:'',//证件号码
       certificateNumber:'',//证书编号
       name:''//姓名
    },
    onLoad: function (options) {

    },
    onShow: function () {
       
    },
	//获取证书编号
	getCertId: function (e) {
	  var value = e.detail.value;
	  this.setData({
	    certificateNumber: value
	  });
	},
	//获取证件号码
	getIdNumber: function (e) {
	  var value = e.detail.value;
	  this.setData({
	    idNumber: value
	  });
	},
	//获取姓名
	getName: function (e) {
	  var value = e.detail.value;
	  this.setData({
	    name: value
	  });
	},
    //登录
    queryClick: function (e) {
	   let _this = this;
       if ("" == _this.data.certificateNumber&&"" == _this.data.name) {
         app.showError('请先输入其中任意两项');
         return false;
       }
	   if ("" == _this.data.certificateNumber&&"" == _this.data.idNumber) {
	     app.showError('请先输入其中任意两项');
	     return false;
	   }
	   if ("" == _this.data.name&&"" == _this.data.idNumber) {
	     app.showError('请先输入其中任意两项');
	     return false;
	   }
	   // if ("" == _this.data.name) {
	   //   app.showError('请输入姓名');
	   //   return false;
	   // }
	   // if ("" == _this.data.idNumber) {
	   //   app.showError('请输入证件号码');
	   //   return false;
	   // }
	  
	   app._get(siteinfo.getUserCertificate, {
	       certificateNumber: _this.data.certificateNumber,
	       idNumber: _this.data.idNumber,
	       name: _this.data.name,
	   }, function (result) {
	       var res = result.data
	       wx.navigateTo({
	            url:`/pages/scoreQueryDetail/scoreQueryDetail?name=${_this.data.name}&idNumber=${_this.data.idNumber}&certificateNumber=${_this.data.certificateNumber}`
	        })
	   })
    },
})